#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include <QString>

#include <controller.h>
#include <bookrepository.h>
#include <personrepository.h>
#include <book.h>
#include <person.h>
#include <bookdatacollector.h>
#include <persondatacollector.h>

class QHBoxLayout;
class QVBoxLayout;
class QPushButton;
class QComboBox;
class QListView;
class QAbstractItemModel;
class QStringList;

class MainWidget : public QWidget
{
	Q_OBJECT

public:
	// Output criteria symbols.
	enum OutputCriteria
	{
		INVALID_SELECTION = 0,
		PERSONS_THAT_HAVE_BORROWED_BOOKS,
		BORROWED_BOOKS,
		BORROWED_BOOKS_TIMED_OUT,
		PERSONS_THAT_BORROWED_BOOKS_SOMETIME,
		ALL_BOOKS
	};

	explicit MainWidget( QWidget *parent = 0 );

public slots:
	void updateContents( const int &index );
	void addPerson();
	void addBook();

private:
	void showPersThatHaveBorrowedBooks();
	void showBorrowedBooks();
	void showBooksTimedOut();
	void showPersThatHaveBorrowedBooksSometime();
	void showAllBooks();

	QPushButton *m_pAddBookButton;
	QPushButton *m_pAddPersonButton;
	QComboBox *m_pComboBoxOption;
	QHBoxLayout *m_pHBoxLayout;
	QVBoxLayout *m_pVBoxLayout;
	QListView *m_pListView;
	QAbstractItemModel *m_pAbstractModel;
	QStringList *m_pModelList;

	static const QString m_pInvalidSelection;
	static const QString m_pPersThatHaveBorrowedBooks;
	static const QString m_pBorrowedBooks;
	static const QString m_pBooksTimedOut;
	static const QString m_pPersThatHaveBorrowedBooksSometime;
	static const QString m_pAllBooks;
	static const long m_pTimeOutDays;

	Book m_book;
	Person m_person;
	BookRepository m_bookRepository;
	PersonRepository m_personRepository;
	Controller m_controller;
	BookDataCollector m_bookDataCollector;
	PersonDataCollector m_personDataCollector;
};

#endif // MAINWIDGET_H
